<?php

class UserController extends Lib2k_Controller_Action{


    public function preDispatch(){
        
   	}

    public function indexAction(){

    }
    
    public function loginAction(){
       
        $form = new Form_User_Login();
        if($this->getRequest()->isPost()){
            $postParams = $this->getRequest()->getPost();
            if($form->isValid($postParams)) {            
                $res = Model_User_Login::login($postParams);
                if($res){
                    echo "Logined";
                    $this->_redirect($this->view->url());
                } else {
                    echo "не верные данные!";
                }
            }
        }                        
        $this->view->assign('form', $form);
    }
    
    
    public function logoutAction(){
        Model_User_Login::logOut();    
        $this->_helper->redirector('login', 'user');
    }
    



}

